package jmine.tec.subscription.ping;

import jmine.tec.annotations.Unmodifiable;
import jmine.tec.subscription.Publication;

/**
 * implementacao de {@link Publication} para um ping. Deve ser usado apenas para tests
 * 
 * @author takeshi
 */
@Unmodifiable
public class Ping implements Publication {

    private static final long serialVersionUID = -5627503912966041881L;

    private final long id;

    /**
     * @param id long
     */
    public Ping(long id) {
        super();
        this.id = id;
    }

    /**
     * {@inheritDoc}
     */
    public String getIdentification() {
        return "ping: " + this.id;
    }

    /**
     * {@inheritDoc}
     */
    public boolean isNewerThan(Publication another) {
        if (another instanceof Ping) {
            Ping o = (Ping) another;
            return this.id > o.id;
        }
        return false;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return this.getIdentification();
    }

    /**
     * @return the id
     */
    public long getId() {
        return this.id;
    }

}
